<?php
// +----------------------------------------------------------------------
// | snake
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 http://baiyf.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: NickBai <1902822973@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\validate;

use think\Validate;

class UserValidate extends Validate
{
    // protected $rule = [
    //     ['user_name', 'unique:user', '管理员已经存在']
    // ];

    protected $rule = [
        ['user_name', 'require|unique:user', '请输入用户名|管理员已经存在'],
        ['real_name', 'require', '真实姓名必须填写'],
        ['password', 'require', '请输入密码'],
        ['role_id', 'require', '请选择管理员'],
    ];

    protected $scene = [
        'add' => ['user_name', 'password'],
        'addData' => ['user_name','role_id','password','real_name'],
        'edit' => ['age','stature','monthIncome','maritalStatus','nickname','headimg','sex'],
    ];

}